#!/usr/bin/perl -w
#===============================================================================
#
#         FILE:  File_Size_Check.pl
#
#        USAGE:  File_Size_Check.pl
#
#  DESCRIPTION:  
#
#      OPTIONS:  ---
# REQUIREMENTS:  ---
#         BUGS:  ---
#        NOTES:  ---
#       AUTHOR:  ZHOU LEI , <networklei@gmail.com>
#      COMPANY:  ultrapower
#      VERSION:  1.0
#      CREATED:  09/15/2009 22:00:17 PM CST
#     REVISION:  ---
#===============================================================================
use Time::Local;

$DIR = "/home/lester/Perl/Test";

chdir $DIR;

@list=`ls -lrt  | grep CF`;

foreach (@list){
	@file = split(" ",$_);
	$file = pop(@file);
	$time = pop(@file);
	$size = (stat $file)[7];
	if ($time =~ /(((0[89])|(1[0-9])|(2[012])):[1-5][0-9])/){
		if ( $size > 1000 and  $size < 10000){
			print "$file time:$1\n$file the current size of $size ok\n"
		}else{
			print "$file time:$1\n$file the current size of $size, exceeding the set threshold 1000-10000
\n";
		}
	}elsif ($time =~ /(((23)|(0[0-7])|(2[012])):[1-5][0-9])/){
		
		if ( $size > 100 and  $size < 2000){
			print "$file time:$1\n$file the current size of $size, ok\n"
		}else{
			print "$file time:$1\n$file the current size of $size, exceeding the set threshold 100-20000
\n";
		}
	}
	
}



